from redis import StrictRedis


class Config:
    DEBUG = None
    # 设置链接数据库redis的ip地址和端口号
    # host = "localhost"
    host = "127.0.0.1"
    port = 6379
    SECRET_KEY = 'LmNoMgkSQRl4hhqGLK0SUDuxVEKsv6ZNyplCLRmt+oO7MhHwzM26tQ=='
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@localhost/test"
    SQLALCHEMY_TRACK_MODIFICATIONS = True
    # 配置数据库redis的链接，用来储存session，实现状态保持
    SESSION_TYPE = 'redis'
    # 对session信息使用签名
    SESSION_USE_SIGNER = True
    # 设置session的有效期
    PERMANENT_SESSION_FILETIME = 86400
    SESSION_REDIS = StrictRedis(host=host, port=port, db=0)


class DevelopeConfig(Config):
    DEBUG = True


class ProductConfig(Config):
    DEBUG = False

config = {
    "developementconfig": DevelopeConfig,
    "productconfig": ProductConfig
}